<?php

/**
 * Question form base class.
 *
 * @package    form
 * @subpackage question
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseQuestionForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'        => new sfWidgetFormInputHidden(),
      'survey_id' => new sfWidgetFormDoctrineSelect(array('model' => 'Survey', 'add_empty' => false)),
      'type'      => new sfWidgetFormChoice(array('choices' => array('Number' => 'Number', 'Boolean' => 'Boolean', 'Text' => 'Text'))),
      'content'   => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'id'        => new sfValidatorDoctrineChoice(array('model' => 'Question', 'column' => 'id', 'required' => false)),
      'survey_id' => new sfValidatorDoctrineChoice(array('model' => 'Survey')),
      'type'      => new sfValidatorChoice(array('choices' => array('Number' => 'Number', 'Boolean' => 'Boolean', 'Text' => 'Text'), 'required' => false)),
      'content'   => new sfValidatorString(),
    ));

    $this->widgetSchema->setNameFormat('question[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Question';
  }

}